package jsyf.oa.web.system;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.system.ShouldSignInFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by WHH-PC on 2018/2/5.
 */
@Api(value = "出勤天数配置接口", description = "出勤天数配置接口")
@Controller
@RequestMapping("/shouldSignIn")
public class ShouldSignInController {
    @Resource
    ShouldSignInFacade shouldSignInFacade;

    @RequestMapping(value = "/save.json", method = RequestMethod.POST)
    public void save(HttpServletResponse response, @RequestBody String jsonData) {
        String id = shouldSignInFacade.save(jsonData);
        JSONObject objResult = new JSONObject();
        objResult.put("id", id);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(objResult));
    }
    @RequestMapping(value = "/getShouldSignInList.json", method = RequestMethod.POST)
    public void getShouldSignInList(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject obj = JSON.parseObject(jsonData);
        List<JSONObject> list = shouldSignInFacade.getShouldSignInList(obj);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(list));
    }
}
